package com.example.aigc_education.enums;

import lombok.Getter;

@Getter
public enum QuizzesQuestionType {

    // 取值为“single(单项选择题)”“multiple(多项选择题)”“judge(判断题)”“subjective(主观题)”“filling(填空题)”，若非任意一个，则默认为“subjective(主观题)”
    SINGLE_CHOICE("single", 0),
    MULTIPLE_CHOICE("multiple", 1),
    JUDGE("judge", 2),
    FILL_BLANK("filling", 3),
    SUBJECTIVE("subjective", 4);

    private final String title;
    private final Integer value;
    QuizzesQuestionType(String title, Integer value) {
        this.title = title;
        this.value = value;
    }

    public static QuizzesQuestionType fromTitle(String title) {
        for (QuizzesQuestionType quizzesQuestionType : QuizzesQuestionType.values()) {
            if (quizzesQuestionType.getTitle().equals(title)) {
                return quizzesQuestionType;
            }
        }
        throw new IllegalArgumentException("No enum constant with title " + title);
    }
}
